﻿
@model CarouselIM

@using (Ajax.BeginForm("AddCarousel", "Carousel",
            new AjaxOptions()
            {
                HttpMethod = "POST",
                OnBegin = "onBegin",
                OnComplete = "onComplete",
                OnSuccess = "updateSuccess",
                //OnFailure = "handleError",
                //  UpdateTargetId = "RoleList"

            }, new { @class = "form-horizontal", role = "form" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <!-- 添加菜单 Modal -->
    <div class="modal fade" id="ModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">创建轮播图</h4>
                </div>
                <div class="modal-body">

                    <div class="form-group">
                        @Html.LabelFor(model => model.PositionId, new { @class = "col-md-2 control-label" })
                        <div class="col-md-10">
                            @Html.DropDownListFor(model => model.PositionId, (SelectList)ViewBag.Positions, new { @class = "form-control", placeholder = Labels.Position })
                            @Html.ValidationMessageFor(model => model.PositionId)
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.Title, new { @class = "col-sm-2 control-label" })
                        <div class="col-md-10">
                            @Html.TextBoxFor(model => model.Title, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.Title, ViewData).Watermark })
                        
                            @Html.ValidationMessageFor(model => model.Title)
                        </div>
                    </div>

              

                    <div class="form-group">
                        @Html.LabelFor(model => model.Description, new { @class = "col-sm-2 control-label" })
                        <div class="col-sm-10">
                            @Html.TextAreaFor(model => model.Description, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.Description, ViewData).Watermark })
                     
                            @Html.ValidationMessageFor(model => model.Description)
                        </div>
                    </div>


                    <div class="form-group">
                        @Html.LabelFor(model => model.WebLink, new { @class = "col-sm-2 control-label" })
                        <div class="col-sm-10">
                            @Html.TextBoxFor(model => model.WebLink, new { @class = "form-control", placeholder = "链接" })
                      
                            @Html.ValidationMessageFor(model => model.WebLink)
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.Importance, new { @class = "col-sm-2 control-label" })
                        <div class="col-sm-10">
                            @Html.TextBoxFor(model => model.Importance, new { @class = "form-control", type = "number", placeholder = "排序" })
                      
                            @Html.ValidationMessageFor(model => model.Importance)
                        </div>

                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.ImageUrl, new { @class = "col-sm-2 control-label" })
                        <div class="col-sm-10">
                            <div class="input-group">
                                @Html.TextBoxFor(model => model.ImageUrl, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.ImageUrl, ViewData).Watermark })
                                <span class="input-group-btn">
                                    <button class="btn btn-default" id="btnImageUrl" type="button"><i class="fa fa-picture-o"></i></button>
                                </span>
                            </div><!-- /input-group -->
                            <span class="help-block">图片尺寸：1920x450像素</span>
                     
                            @Html.ValidationMessageFor(model => model.ImageUrl)
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.ImageUrlMobile, new { @class = "col-sm-2 control-label" })
                        <div class="col-sm-10">
                            <div class="input-group">
                                @Html.TextBoxFor(model => model.ImageUrlMobile, new { @class = "form-control", placeholder = Labels.ImageUrlMobile })
                                <span class="input-group-btn">
                                    <button class="btn btn-default" id="btnImageUrlMobile" type="button"><i class="fa fa-picture-o"></i></button>
                                </span>
                            </div><!-- /input-group -->
                            <span class="help-block">图片尺寸：1920x450像素</span>
                            @Html.ValidationMessageFor(model => model.ImageUrlMobile)
                        </div>
                    </div>


                    <div class="form-group">

                        <div class="col-sm-10 col-md-offset-2">
                            <div class="checkbox">
                                <label>
                                    @Html.CheckBoxFor(model => model.Active)  @Html.DisplayNameFor(model => model.Active)
                                </label>
                            </div>
                      
                            @Html.ValidationMessageFor(model => model.Active)
                        </div>

                    </div>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-remove fa-fw"></i>@Buttons.Cancel</button>
                    <button class="btn btn-primary" type="submit" id="btnSave"><i class="fa fa-save fa-fw"></i>@Buttons.Save</button>
                </div>
            </div>
        </div>
    </div>
}

<script type="text/javascript" language=javascript>
    $.validator.unobtrusive.parse(document);
</script>